package com.imooc.product.design.sing;

/**
 * Created on 2020/2/3.
 *
 * @author Grak
 * @since 1.0
 */
public class LazySingleton {
    private static LazySingleton lazySingleton = null;
    private LazySingleton(){}

    /**
     * 有线程安全问题，需要添加synchronized
     * @return
     */
    public synchronized static LazySingleton getInstance(){
        if(lazySingleton == null){
            lazySingleton = new LazySingleton();
        }
        return lazySingleton;
    }
}
